package com.fy.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class TreeEntity implements Serializable {

    private static final long serialVersionUID = 1078459635026071151L;

    private Integer id;
    private Integer parentId;
    private List<TreeEntity> child;
    private String name;

    public <T extends TreeEntity> void addChild(TreeEntity  baseTreeNode) {
        if (this.child == null) {
            this.setChild(new ArrayList());
        }

        this.getChild().add(baseTreeNode);
    }
}

